<template>
	<view class="cu-bar tabbar bg-white shadow foot" id="tabbar">
		<view v-for="(item,index) in tabbarList" :key="index" class="action"
			:style="{color:component == item.component ? '#ff0000':'#969696'}" @tap="navChange(item.component)">
			<view style="margin-bottom:5rpx">
				<view class="iconfont" :class="[item.icon]" style="font-size:50rpx;"></view>
			</view>
			<view>{{$t(item.name)}}</view>
		</view>
	</view>
</template>

<script>
	import * as storage from '@/util/storage'
	export default {
		data() {
			return {}
		},
		name: 'Tabbar',
		emits: ['nav-change'],
		computed: {
			themeConfig() {
				return this.$store.state.themeConfig
			}
		},
		props: {
			component: {
				type: String,
				default: ''
			},
			tabbarList: {
				type: Array
			},
		},
		mounted() {
			uni.createSelectorQuery().in(this).select('#tabbar').boundingClientRect((e) => {
				storage.setTabbarHeight(e.height)
			}).exec()
			// storage.setTabbarHeight(80)
		},
		methods: {
			navChange(e) {
				this.$emit('nav-change', e)
			},
		}
	}
</script>

<style>
</style>
